﻿<!--#include file="include/config.asp"-->
<!--#include file="include/conn_f.asp"-->
<!--#include file="ipcountry/ipcountry.asp"-->
<!--#include file="top.asp"-->
<!--#include file="left.asp"-->
<p align="center">
    <%
username=left(saferequest("username",0),20)
password=left(saferequest("password",0),10)
customer_name=left(saferequest("customer_name",0),20)
email=left(saferequest("email",0),30)
phone_country=left(saferequest("phone_country",0),15)
phone=left(saferequest("phone",0),20)
phone=phone_country&phone
mobile_country=left(saferequest("mobile_country",0),15) 
mobile=left(saferequest("mobile",0),20)
mobile=mobile_country&mobile
address=left(saferequest("address",0),40)
country=left(saferequest("country",0),20)
city=left(saferequest("city",0),20)
zip=left(saferequest("zip",0),10)
qq=left(saferequest("qq",0),30)
refer=Request.Cookies("refer")
mac_id=Request.Cookies("mac_id")
IP=Request.ServerVariables("remote_addr")
ipcountry=IP2Country(IP)

sql="select email from customer where username='"&username&"' "
Set rs=conn.execute(sql)
If Not rs.eof Then
    Response.Write "这个会员帐号已经存在，请选择其他的帐号!<br /><a href='javascript:history.go(-1)'>返回</a>"
Else
    rs.close
    sql="insert into customer(username,password,name,phone,email,address,country,city,zip,mobile,qq,refer,ip,IP_country,mac_id,"
    sql=sql&"reg_time,lastlogin_time) values('"&username&"',old_password('"&password&"'),'"&customer_name&"','"
    sql=sql&phone&"','"&email&"','"&address&"','"&country&"','"&city&"','"&zip&"','"&mobile&"','"&qq&"','"&refer
    sql=sql&"','"&ip&"','"&ipcountry&"','"&mac_id&"',now(),now())"


    conn.execute sql
    sql_cust="select LAST_INSERT_ID() from customer"
    rs.open sql_cust,conn
    cust_id=rs(0)
    Session("cust_id")=cust_id
    Session("username")=username
    
    sql="update customer set very_code=MD5(cust_id+balance+325.61)"

    '黑名单鉴别
    sql_black="select * from blacklist where blacklist_value='"&ip&"' or blacklist_value='"&email&"' or blacklist_value='"&phone&"' or blacklist_value='"&customer_name&"' or blacklist_value='"&mac_id&"' "	
    Set rs_black=conn.execute(sql_black)
    If Not rs_black.eof Then
        sql=sql&",cust_memo='与黑名单中记录 有关联!blacklist_id="&rs_black("blacklist_id")&"'"
    End If

    sql=sql&" where cust_id="&cust_id
    conn.execute sql


    Response.Write "<br />会员注册成功，您现在可以购买您需要的卡了!<br /><br />"
    If 1=2 Then
    %>
    如果您要使用信用卡(paypal)支付购买商品,请您先"电话激活会员帐号".<br />
    <input type="submit" onclick="location.href='http://www.cardinchina.com/account_active.asp'"
        value="现在电话激活会员帐号"><br />
    <br />
    <%
    End If
    mailbody="游龙网为海内外客户提供游戏卡、Q币卡、电话卡等数字卡销售服务<br />"&chr(13)
    mailbody="会员帐号(username):"&username&" <br />"&chr(13)
    mailbody=mailbody&"会员密码(password):"&password&"<br />"&chr(13)
    mailbody=mailbody&"游龙网网址:<a href='http://www.cardinchina.com/'>www.cardinchina.com</a>"&chr(13)	
    mailbody=mailbody&"请不要回复本邮件,此邮件是系统发信,联系客户服务请发e-mail到:cs@cardinchina.com"
    
    'Dim MailObject 
    'Set MailObject = Server.CreateObject("CDONTS.NewMail") 
    'MailObject.From="no-reply@cardinchina.com"	'发件邮址 
    'MailObject.To=email '收件人 
    'MailObject.Subject="您在游龙网的注册信息" 
    'MailObject.Body=mailbody 
    'MailObject.MailFormat = 0
    'MailObject.BodyFormat = 0
    'MailObject.Send '发送邮件 
    
    Set msg = Server.CreateOBject( "JMail.Message" )
    msg.Logging = true
    msg.silent = true
    msg.Charset = "utf-8"
    msg.From = "no-reply@cardinchina.com"
    msg.FromName = "游龙网"
    msg.MailServerUserName = "no-reply@cardinchina.com"
    msg.MailServerPassword = "max3124"
    msg.AddRecipient email
    msg.Subject = "您在游龙网的会员注册信息"
    msg.HTMLBody = mailbody
    
    If msg.Send("mail.cardinchina.com" ) Then						
        Response.Write "<br />会员注册信息也发送到您的信箱中了!"	
    End If 

    Set msg = Nothing

End If


    %>
    
    <!--#include file="bottom.asp"-->
